#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QTcpSocket>
#include <QTcpServer>
#include "youwin.h"
#include <QWidget>

class MainWindow : public QWidget
{
    Q_OBJECT
private:
    QPixmap* ChessBoard;
    QPixmap* BlackChess;
    QPixmap* WhiteChess;
    YouWin*  dialog;
    int** Chess;
    int x = -1;
    int y = -1;
    int cols;
    int rows;
    int width_block; // 色块位宽
    int width_line;  // 分割线位宽
    int youAreReady;
    QTcpSocket* socket; // 客户端执白子
    QTcpServer* server; // 服务端执黑子
public:
    MainWindow(QWidget *parent = nullptr);
    void paintEvent(QPaintEvent* e);
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    int getSituation(int x,int y);
    ~MainWindow();
signals:
    void win();
};
#endif // MAINWINDOW_H
